package com.foreknow.elmboot.service.impl;

import com.foreknow.elmboot.mapper.CartMapper;
import com.foreknow.elmboot.po.Cart;
import com.foreknow.elmboot.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartServicelmpl implements CartService {

    @Autowired
    private CartMapper cartMapper;

    @Override
    public List<Cart> getCartByUserId(String userId) {
        return cartMapper.getCartByUserId(userId);
    }

    @Override
    public List<Cart> listCart(String userId, Integer businessId) {
        return cartMapper.listCart(userId,businessId);
    }

    @Override
    public int saveCart(Integer foodId,Integer businessId,String userId,Integer quantity) {
        return cartMapper.saveCart(foodId,businessId,userId,quantity);
    }

    @Override
    public int updateCart(Integer foodId,Integer businessId,String userId,Integer quantity) {
        return cartMapper.updateCart(foodId,businessId,userId,quantity);
    }

    @Override
    public int removeFood(Integer foodId,Integer businessId,String userId) {
        return cartMapper.removeFood(foodId,businessId,userId);
    }

    @Override
    public int removeCart(Integer businessId,String userId) {
        return cartMapper.removeCart(businessId,userId);
    }
}
